package com.gym.tygglxt.web.controller;


import com.gym.tygglxt.model.EventManage;
import com.gym.tygglxt.model.PageResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/events")
public class EventsController {
    @RequestMapping("/notice")
    public  String notice(){
        System.out.println("赛事公告");
        return"events/notice";

    }

    @RequestMapping("/referee")
    public  String referee(){
        System.out.println("裁判公告");
        return"events/referee";

    }

    @RequestMapping("listJson")
    @ResponseBody
    public PageResult<EventManage> listJson(){
        PageResult<EventManage> result = new PageResult<EventManage>();
        result.setCode(0);
        result.setCount(300);
        List<EventManage> list = new ArrayList<EventManage>();

        EventManage eventManage1 = new EventManage();
        eventManage1.setEveid(1);
        eventManage1.setEvename("足球赛");
        eventManage1.setEvepeople("小汪");
        eventManage1.setEveplace("足球场");
        list.add(eventManage1);

        EventManage eventManage2 = new EventManage();
        eventManage2.setEveid(2);
        eventManage2.setEvename("篮球赛");
        eventManage2.setEvepeople("小里");
        eventManage2.setEveplace("篮球场");
        list.add(eventManage2);
        result.setData(list);
        return result;
    }

}
